﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ESN.Helpers;

namespace HocVuiDiary.Controllers
{
    public class LangController : Controller
    {
        //
        // GET: /Lang/
        public ActionResult Index(string lang = "en")
        {
            CookiesHelper.UpdateSubkey("userpref", "lang", lang);
            //Response.Cookies["userpref"]["lang"] = "vi";
            //Response.Cookies["userpref"].Expires = DateTime.Now.AddDays(30);
            if (Request.ServerVariables["http_referer"] == null)
                return RedirectToAction("Index", "Home");
            else
                return Redirect(Request.ServerVariables["http_referer"]);
        }

    }
}
